<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>导入</title>
    <link rel="stylesheet" th:href="@{/css/tip.css}"/>
    <link th:replace="common/header"/>
    <script type="text/javascript" th:src="@{/js/layer/tip.js}"></script>
</head>
<body class="no-skin">
<div th:replace="common/top"/>
<div class="main-container ace-save-state" id="main-container">
    <div th:replace="common/menu"/>
    <div class="main-content">
        <div class="main-content-inner">
            <div th:replace="common/title"/>
            <div class="page-content">
                <div th:replace="common/skin"/>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" action="add.do" name="form" th:action="@{/houseInfo/import}"
                              th:method="post" enctype="multipart/form-data">
                            <h3 class="header smaller lighter blue"><i class="fa fa-file-archive-o"
                                                                       aria-hidden="true"></i>上传Excel</h3>
                            <div class="row-fluid">
                                <!--PAGE CONTENT BEGINS HERE-->
                                <div class="span6">
                                    <div class="control-group">
                                        <label class="control-label" for="file">上传文件:<span
                                                style="color:red">*</span></label>
                                        <div class="controls">
                                            <input type="file" name="file" id="file" class="input_fix"/>
                                        </div>
                                    </div>
                                </div>
                                <div class="span6">
                                    <div class="control-group">
                                        <span style="color:red"><span id="error" th:text="${msg}">Name Error</span>&nbsp;</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="text-center span12">
                                    <button shiro:hasPermission="/houseInfo/import" class="btn btn-primary"
                                            type="submit"><i class="fa fa-floppy-o" aria-hidden="true"></i>提交
                                    </button>
                                    <button shiro:hasPermission="/houseInfo/import" class="btn btn-danger" type="reset">
                                        <i class="fa fa-times" aria-hidden="true"></i>取消
                                    </button>
                                    <a shiro:hasPermission="/houseInfo/getAll" class="btn" href="getAll"
                                       th:href="@{/houseInfo/getAll}"><i class="fa fa-reply"
                                                                         aria-hidden="true"></i>返回</a>
                                </div>
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <div th:replace="common/footer"/>
</div><!-- /.main-container -->
<div th:replace="common/buttom"/>
<div th:replace="common/layer"/>
<script type="text/javascript">
    $("#file").change(function () {
        var value = $(this).val();
        var v = value.substr(value.length - 3).toLowerCase();
        if ("xls" !== v) {
            showTip('文件类型必须是*.xls', 4000);
            $(this).val("");
            return false;
        }
    });

    $("form").submit(function () {
        if ($("#file").val() === "") {
            $("#error").text("请选择上传文件，文件类型必须是*.xls");
            return false;
        }
        $(":submit", this).attr("disabled", "disabled");
    });
</script>
</body>
</html>
